ENT-13001: Expand release-information with history of releases.json files#18
Conversation
2725ced to
5da6c6f
Compare
465300f to
8fb920e
Compare
larsewi
left a comment
There was a problem hiding this comment.
Good job 🚀 Only some smaller nit picks. Feel free to dismiss the suggestions if you don't agree.
| return versions_dict, checksums_dict, files_dict | ||
|
|
||
|
|
||
| def filter_unstable_releases(data): |
There was a problem hiding this comment.
The function name says "filter unstable" but it's actually returning stable releases. Worth considering a name like get_stable_releases or filter_out_unstable_releases for clarity.
| # Filter the data to only include stable releases (not debug, alpha, or beta releases): | ||
| filtered_data = [] | ||
|
|
||
| for release_data in data.get("releases", []): | ||
| if release_data.get("debug") is True: | ||
| continue | ||
| if release_data.get("alpha") is True: | ||
| continue | ||
| if release_data.get("beta") is True: | ||
| continue | ||
|
|
||
| filtered_data.append(release_data) | ||
|
|
||
| return filtered_data |
There was a problem hiding this comment.
The logic is correct but the three if/continue blocks are redundant. They can be collapsed into a single condition. You could also consider using list comprehension which is an idiomatic pattern in Python.
return [
r for r in data.get("releases", [])
if not (r.get("debug") or r.get("alpha") or r.get("beta"))
]
| def sort_release_data(file_checksums_dict): | ||
| # Newest versions first, and files sorted alphabetically within each version | ||
| for v in file_checksums_dict.keys(): | ||
| file_checksums_dict[v] = dict_sorted_by_key(file_checksums_dict[v]) |
There was a problem hiding this comment.
This function mutates its input (file_checksums_dict[v] = ...) before building the sorted copy below. The caller may not expect their dict to be modified as a side effect of this function. Consider creating the copy first.
Added functions for creating a history of releases.json to the generate-release-information dev command.